<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title> 用户列表  <{$smarty.const.WEB_NAME}></title>
	<link rel="stylesheet" type="text/css" href="./skin/<{$smarty.const.TPL_NAME}>/style.css" />
	<script type="text/javascript" src="./skin/<{$smarty.const.TPL_NAME}>/comm.js"></script>
	<script type="text/javascript" src="./skin/default/calendar.js"></script>
 </head>
 <body>
<table width="100%" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="tableList tip_bug">
  <tr> 
    <th class="h1">用户列表</th>
	<{if $smarty.session.type == 2}>
	<th width="200"><a href="#" onclick="newUSerInfo()">添加新用户</a></th>
	<{/if}>
  </tr>
</table>	 

	   <table width="100%" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" id="tableList">
         <tr class="tit">
           <th width="40" align="center">编号</th>
           <th align="center">用户名</th>
		   <th align="center">部门</th>
           <th align="center">类型</th>
		   <th align="center">评定等级</th>
		   <th align="center">考核类别</th>
		   <td align="center">入职日期</th>
		   <td align="center">离职日期</th>
           <th align="center">登录次数</th>
           <th align="center">最后登录时间</th>
           <th align="center" width="80">qq</th>
		   <th align="center">操作</th>
         </tr>
		 
		 <tr>
		 <{section name=list loop=$userList}>
		 <tr>
		    <td><{$userList[list].id}></td>
		    <td><{$userList[list].name}></td>
			<td>
				<{section name=l loop=$departmentList}>
					<{if $departmentList[l].id == $userList[list].departmentId}>
			    		<{$departmentList[l].name}>
					<{/if}>
				 <{/section}>
			</td>
		    <td flag="<{$userList[list].type}>">
				<{if $userList[list].type == 0}>用户
				<{elseif $userList[list].type == 1}>主管
				<{else}>超管
				<{/if}>
			</td>
			<td flag="<{$userList[list].level}>">
				<{if $userList[list].level == 1}>初级
				<{elseif $userList[list].level == 2}>初级增强
				<{elseif $userList[list].level == 3}>中级
				<{elseif $userList[list].level == 4}>中级增强
				<{elseif $userList[list].level == 5}>高级
				<{else}>未知
				<{/if}>
			</td>
			<td flag="<{$userList[list].kpiType}>">
				<{if $userList[list].kpiType == 1}>开发
				<{elseif $userList[list].kpiType == 2}>测试
				<{elseif $userList[list].kpiType == 3}>集成
				<{else}>不考核
				<{/if}>
			</td>
			<td><{$userList[list].entryDate}></td>
			<td><{$userList[list].leaveDate}></td>
		    <td><{$userList[list].count}></td>
		    <td><{$userList[list].lastLoginTime}></td>
		    <td><{$userList[list].qq}></td>
			<td align="center">
			 <{if $userList[list].purview == 1}>
			 	<{assign var="stateTip" value="取消"}>
			 <{else}>
			 	<{assign var="stateTip" value="查看"}>
			 <{/if}>
			 
             <{if $userList[list].isOut == 0}>
			    <{if $userList[list].type != 2}>
				   <a href="?q=viewUserSummary&id=<{$userList[list].id}>" title="查看其他人工作报告的权限"><{$stateTip}></a> 
				<{else}>
				  <span class="state_1">查看</span>
				<{/if}>
			 <{else}>
                  <span class="state_0"><{$stateTip}></span>
			 <{/if}>

			 <{if $userList[list].isOut == 0}>
				<{if $userList[list].name == $smarty.const.FOUNDER}>
				   <{if $smarty.session.name == $smarty.const.FOUNDER}>
				    <a href="#" onclick="openWindow(this.parentNode.parentNode.childNodes , <{$smarty.session.type}> , <{$userList[list].departmentId}>, <{$userList[list].level}>,<{$userList[list].qq}>,<{$userList[list].kpiType}>,'<{$userList[list].entryDate}>','<{$userList[list].leaveDate}>')">修改</a>
				   <{else}>
				     <span class="state_1">修改</span>
				   <{/if}>				 
				<{else}>
				  <{if $smarty.session.type < $userList[list].type }>
				    <span class="state_1">修改</span>
				  <{else}>
				  	 <a href="#" onclick="openWindow(this.parentNode.parentNode.childNodes , <{$smarty.session.type}> , <{$userList[list].departmentId}>, <{$userList[list].level}>,<{$userList[list].qq}>,<{$userList[list].kpiType}>,'<{$userList[list].entryDate}>','<{$userList[list].leaveDate}>')">修改</a> 
				  <{/if}>
				<{/if}>
			 <{else}>
                <span class="state_0">修改</span>
			 <{/if}>
			 
				<{if $userList[list].isOut == 0}>
				    <{if $userList[list].departmentId == $smarty.session.departmentId && $userList[list].type != 2}>
			    		<a href="#" onclick="deleteArticle('index.php?q=Separation/<{$userList[list].id}>')">离职</a>
					<{elseif $smarty.session.name == $smarty.const.FOUNDER && $userList[list].name != $smarty.session.name}>
						<a href="#" onclick="deleteArticle('index.php?q=Separation/<{$userList[list].id}>')">离职</a>
					<{else}>
						 <span class="state_1">离职</span>
					<{/if}>
                <{else}>
				    <span class="state_0">离职</span>
				<{/if}>
				<{if $smarty.session.type == 2}>	
				 	  <a href="#" onclick="deleteArticle('index.php?q=removeUserInfpSava&id=<{$userList[list].id}>')">删除</a>

				<{/if}>
			</td>
		 </tr>
		 <{/section}>
       </table>




	   <table border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" id="newUSer" 
	   	class="msg_box" style="width:230px; display:none; left:320px;top:150px;height:250px">
	   <form method="post" name="form2" id="form2" onsubmit="return dataValid('form2')" 
	   	action="index.php?q=addUserInfo">		
         <tr class="tit">
		   <th align="center" colspan="2">添加用户</th>
         </tr>
		 <tr>
		 <tr>
		    <td width="50" align="center">名称</td>
		    <td><input type="text" name="name" id="n_userName"  class="input_1"/></td>
		 </tr>
		 <tr>
		    <td width="50" align="center">密码</td>
		    <td><input type="password" name="pass" id="n_passName" class="input_1" size="22" /></td>
		 </tr>
		 <tr>
		    <td width="50" align="center">qq</td>
		    <td><input type="text" name="qq" class="input_1" id="n_qq"  onkeyup="value=value.replace(/[^\d]/g,'')"  /></td>
		 </tr>
	    <{if $smarty.session.type == 2}>
		 <tr>
		    <td width="50" align="center">部门</td>
		    <td>
			   <select name="departmentId" style="margin:4px" id="selectData" onchange="newResource(this)">>
			     <{section name=list loop=$departmentList}>
			    	<option value="<{$departmentList[list].id}>"><{$departmentList[list].name}></option>
				 <{/section}>
			     <{if $smarty.session.type == 2}> <option style="color:red" value="0">添加</option><{/if}>
			   </select>
			</td>
		 </tr>
		 <{else if($smarty.session.type == 1)}>
		    <input type="hidden" name="departmentId" value="<{$smarty.session.departmentId}>" />
		 <{/if}>
		 <tr>
		    <td align="center" colspan="2">
			  <input type="submit" class="submit" value="提交">
			  <input type="button" value="关闭" onclick="remove('newUSer')" class="submit"  />
			</td>
		 </tr>
	   </form>
       </table>



   <div id="lockScreen" style="display:none; left:320px;height:350px">
   	<h3 style="padding-top:6px" id="title">用户资料修改</h3>
    <form method="post" action="index.php?q=editUserInfo" onsubmit="return passValid()">
		<input type="hidden" id="userID" name="id" />
      <table >
		<tr>
			<td>用户名：</td>
			<td><input type="text" id="userName" class="inputText" disabled/></td>
		</tr>
		<tr>
			<td>密码:</td>
			<td><input type="password"  name="pass" id="EditPass" class="inputText" /></td>
		</tr>
		<tr>
			<td>qq:</td>
			<td><input type="text"  name="qq" id="EditQQ" value="" class="inputText" /></td>
		</tr>
		<{if $smarty.session.type == 2}>
		<tr>
		  <td>部门:</td>
		  <td>
			   <select name="departmentId" style="margin:4px" id="selectEdit">
			     <{section name=list loop=$departmentList}>
			    	<option value="<{$departmentList[list].id}>"><{$departmentList[list].name}></option>
				 <{/section}>
			     <{if $smarty.session.type == 2}> 
					<option style="color:red" value="0">添加</option>
				 <{/if}>
			   </select>		   
		  </td>
		</tr>
		<tr>
			<td>评定等级:</td>
			<td>
				<select name="level" style="margin:4px" id="levelId">
					<option value="1">初级</option>
					<option value="2">初级增强</option>
					<option value="3">中级</option>
					<option value="4">中级增强</option>
					<option value="5">高级</option>
				</select>
			</td>
		</tr>
		<tr>
			<td>考核类别:</td>
			<td>
				<select name="kpiType" style="margin:4px" id="kpiTypeId">
					<option value="0">不考核</option>
					<option value="1">开发</option>
					<option value="2">测试</option>
					<option value="3">集成</option>
				</select>
			</td>
		</tr>
		<tr>
			<td>入职日期:</td>
			<td><input type="text" name="entryDate" id="entryDateId" value="" 
				class="timeInput" style="margin-left:5px;" onclick="MyCalendar.SetDate(this)" />
			</td>
		</tr>
		<tr>
			<td>离职日期:</td>
			<td><input type="text" name="leaveDate" id="leaveDateId" value="" 
				class="timeInput" style="margin-left:5px;" onclick="MyCalendar.SetDate(this)" />
			</td>
		</tr>
		<tr>
			<td>用户类型:</td>
			<td>
			<input type="radio" name="power" value="0" id="p_0"/> <label for="p_0">员工</label>
			<input type="radio" name="power" value="1" id="p_1"/> <label for="p_1">主管</label>
			<{if $smarty.session.name == $smarty.const.FOUNDER}>
				<input type="radio" name="power" value="2" id="p_2"/> <label for="p_2">超管</label>
			<{/if}>
			</td>
		</tr>
		<{/if}>
		<tr>
		  <td colspan="2" align="center" height="30">
		    <input type="submit" value="提交" class="inputBtn" /> 
			<input type="button" value="关闭" onclick="remove('lockScreen')" class="inputBtn"  />
		  </td>
		</tr>
      </table>
	 </form>
   </div>



<table border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" id="newUSerBox" class="msg_box" style=" height: 34px; width:250px; display:none; left:320px;">
	
  <tr>
    <td>名称</td>
	<td><input type="text" name="name" id="labelName" class="inputText"/></td>
	<td><input type="button" value="确定" class="inputBtn" onclick="insertResource(0)"/></td>
  </tr>
</table>



<SCRIPT type="text/javascript">

	function passValid()
	{
		 if($('EditPass').value == "") {
		 	if( confirm("密码为空，你需要继续吗?") == false ) {
		   		return false;
			}
		 }
		 
		 return true;
	}


	var posX;
	var posY;       
	var fdiv = document.getElementById("lockScreen");           
	document.getElementById("title").onmousedown=function(e)
	{
	    if(!e) e = window.event;  //如果是IE
	    posX = e.clientX - parseInt(fdiv.style.left);
	    posY = e.clientY - parseInt(fdiv.style.top);
	    document.onmousemove = mousemove;           
	}
	
	document.onmouseup = function()
	{
	    document.onmousemove = null;
	}
	
	function mousemove(ev)
	{
	    if(ev==null) ev = window.event;//如果是IE
	    fdiv.style.left = (ev.clientX - posX) + "px";
	    fdiv.style.top = (ev.clientY - posY) + "px";
	}
</SCRIPT>
 </body>
</html>
